#ifndef QWORLD_H
#define QWORLD_H

#include <QMainWindow>

class QWorldScene;
class QStatistic;
class QGraphicsView;
class QTableWidget;
class QGame;
class AddDialog;
class ConfigDialog;
class QLifeTable;
class QWorldView;
class QSpinBox;
class QScriptEngine;

/**
 *	@author Stefan Weigert <stefan.weigert@mailbox.tu-dresden.de>
 */

class QWorld : public QMainWindow
{
		Q_OBJECT

	public:
		QWorld();

		QLifeTable* getLifeTable();

	private:
		int width;
		int height;

		QAction* newAction;
		QAction* exitAction;

		QAction* logLifeAction;
		QAction* logDnaAction;
		QAction* startAction;
		QAction* stopAction;
		QAction* addAction;
		QAction* addAnimalAction;
		QAction* addGravityAction;

		QAction* drawOpenGLAction;
		QAction* drawLinesAction;
		QAction* drawCirclesAction;
		QAction* antialiasAction;

		QAction* showDetailsAction;
		QAction* showLifeStatAction;
		QAction* showDnaStatAction;
		QAction* showConfigAction;
		QAction* showWorldAction;

		QGame* game;

		QWorldView* worldView;
		QWorldView* lifeStatisticView;
		QWorldView* dnaStatisticView;
		QDockWidget* detailsDock;
		QDockWidget* lifeStatDock;
		QDockWidget* dnaStatDock;
		QDockWidget* configDock;
		QDockWidget* worldDock;
		QWorldScene* scene;
		QLifeTable* detailsTable;
		QStatistic* lifeStat;
		QStatistic* dnaStat;
		QSpinBox* lifeUpdateIntervalSpin;
		QSpinBox* statUpdateRatioSpin;
		QSpinBox* sceneUpdateRatioSpin;

		AddDialog* addDlg;
		ConfigDialog* confDlg;

		void createActions();
		void createMenus();
		void createToolBar();

	private slots:
		void newGame();
		void quit();

		void drawOpenGL();
		void drawLines();
		void drawCircles();
		void drawAntialiased();

		void logLife();
		void logDna();
		void add();
		void addAccepted();
		void confAccepted();
		void addAnimal();
		void addGravity();
		void startGame();
		void pauseGame();
		void stopGame();
};

#endif
